/**
 *	主要功能：
 *      1.创建用户
 *      2.用户赋权
 *      3.创建表空间
 *  作者：liuzhh
 */

sqlplus /nolog;

--以dba权限连接
conn sys/system@orcl_poc as sysdba;

--创建表空间
-- Create the user tablespace
CREATE TABLESPACE TS_FJPOC 
	DATAFILE '%ORACLE_BASE%\oradata\%ORACLE_SID%\fjpoc.dbf' 
	SIZE 1024M REUSE 
	AUTOEXTEND ON NEXT 1024M 
	MINIMUM EXTENT 1M
	DEFAULT STORAGE ( 
		INITIAL 128K 
		NEXT 128K 
		MINEXTENTS 1 
		MAXEXTENTS 4096 
		PCTINCREASE 0);
		
-- Create the user index tablespace
CREATE TABLESPACE TS_FJPOC_INDEX 
	DATAFILE '%ORACLE_BASE%\oradata\%ORACLE_SID%\fjpoc_index.dbf' 
	SIZE 512M REUSE 
	AUTOEXTEND ON NEXT 512M 
	MINIMUM EXTENT 1M
	DEFAULT STORAGE ( 
		INITIAL 128K 
		NEXT 128K 
		MINEXTENTS 1 
		MAXEXTENTS 4096 
		PCTINCREASE 0);

-- 创建用户 
create user poc
identified by poc
default tablespace TS_FJPOC
temporary tablespace TEMP
profile DEFAULT;
  
--赋权
grant connect to poc with admin option;
grant dba to poc with admin option;
grant resource to poc with admin option;
grant imp_full_database to poc with admin option;
grant exp_full_database to poc with admin option;

grant all privileges to poc with admin option;

--断开连接
disconn;

--用户连接
conn poc/poc@orcl;
--断开连接
disconn;




